<template>
  <div class="rightlist">
    <!-- 面包蟹 -->
    <el-breadcrumb separator="/">
      <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
      <el-breadcrumb-item>权限管理</el-breadcrumb-item>
      <el-breadcrumb-item>角色列表</el-breadcrumb-item>
      <el-breadcrumb-item>权限列表</el-breadcrumb-item>
    </el-breadcrumb>
    <!-- 表格 -->
    <el-table ref="rightslist" :data="rightslist" style="width: 100%">
      <el-table-column type="index" width="50"></el-table-column>
      <el-table-column prop="authName" label="权限名称" width="120"></el-table-column>
      <el-table-column prop="path" label="路径" width="120"></el-table-column>

      <el-table-column label="层级">
        <!-- 利用固定的方法插槽 -->
        <template slot-scope="scope">{{scope.row.level | levelFormat}}</template>
      </el-table-column>
    </el-table>
  </div>
</template>


<script>
import { getAllRightList } from "@/api/rights.js";

export default {
  data() {
    return {
      rightslist: []
    };
  },
  mounted() {
    getAllRightList("list").then(res => {
      console.log(res);
      this.rightslist = res.data.data;
    });
  },
  filters: {
    levelFormat: (level) => {
      // console.log(111111111111111111111111111111111111111111);

      if (level === "0") {
        return "一级";
      } else if (level === "1") {
        return "二级";
      } else if (level === "2") {
        return "三级";
      }
    }
  }
};
</script>
<style>
</style>

